package com.project.controller.statisticsController;

import com.github.pagehelper.PageInfo;
import com.project.bean.CustomerStatisticsBean;
import com.project.bean.SaleStatisticsBean;
import com.project.service.statisiticsService.ICustomerStatisticsService;
import com.project.service.statisiticsService.ISaleStstisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("statistics")
public class StatisticsController {
    @Autowired
    private ICustomerStatisticsService customerService;
    @Autowired
    private ISaleStstisticsService saleService;

    @RequestMapping("customerFindByItem")
    public PageInfo<CustomerStatisticsBean> customerFindByItem(int pageNO, String name, LocalDate startDate, LocalDate endDate) {
        return customerService.findByItem(pageNO, name, startDate, endDate);
    }

    @RequestMapping("saleFindByItem")
    public PageInfo<SaleStatisticsBean> saleFindByItem(int pageNO, String factory, LocalDate startDate, LocalDate endDate){
        return saleService.findByItem(pageNO,factory,startDate,endDate);
    }

}
